 

const defaultState={

    token:"",
    menus:[],
    userInfo:{name:"张三",age:18}

}

export default (state=defaultState,action:any)=>{

    console.log(9999,action);

    if(action.type==="UpdateMenus"){
        return {...state,menus:action.data}
    }
    

    if(action.type==="UpdateToken"){

    //    let newState=  JSON.parse(JSON.stringify(state));
    //    newState.token=action.data;
    //    return newState;
        return {...state,token:action.data}

    }
    if(action.type==="UpdateUserInfo"){

        return {...state,userInfo:action.user}
    }
    

    return {...state}

}